<?php
define("DEBUG",0);
define("ERROR_LOG",1);
	class error{
		function __construct(){}
		static public  function error($errType,$error,$file,$line){
			switch($errType){
				case E_ERROR:
				case E_USER_ERROR:
				case E_WARNING:
				    $e = "[时间]".date("y-m-d h:i:s")."[错误]".$error."<br/>[文件]".$file."<br/>[行号]".$line."\n";
				    if(DEBUG)
				   	 echo $e;
				    if(ERROR_LOG)
				    	log::write($e);
				  break;
				default:
					echo " default";
			}
		}
	}
	class log{
		static public function write($error,$type=3,$toFile=''){
			$logFile = date("ymd").".php";
			error_log($error,$type,"log/".$logFile);
		}
	}
	set_error_handler(array("error","error"),E_ALL);
	include "ds";
?>